<%@ page language="java" pageEncoding="UTF-8"
	contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
	String basePath = request.getContextPath() + "/";
%>
<div class="wrapper wrapper-content">
	<div class="col-xs-12">
		<div class="ibox">
			<div class="ibox-content">
				<form name="FormPost" id="system-addOrUpdate-form"
					class="form-horizontal" method="post" action="" style="width: 100%">
					<!--操作类型  -->
					<input type="hidden" value="${type}" name="type">
					<!--主键  -->
					<input type="hidden"
						value="${empty system?'':system.stdSrcSysId }" name="stdSrcSysId">

					<div class="form-group">
						<label class="col-sm-4 control-label"
							style="white-space: nowrap; text-align: left">源系统:</label>
						<div class="col-sm-7">
							<input type="text" name="srcSys" id="srcSys1" onkeyup="value=value.replace(/[^\w_]/g,'')"
								value="${empty system?'':system.srcSys }"
								class="form-control" datatype="*" nullmsg="源系统" required />
								<span style="font-family: Arial, Helvetica, sans-serif; color: #ff0000;" id="check"></span>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-4 control-label"
							style="white-space: nowrap; text-align: left">源系统名称:</label>
						<div class="col-sm-7">
							<input type="text" name="srcSysName" id="srcSysName" onkeyup="value=value.replace(/[^\a-\z\A-\Z0-9\u4E00-\u9FA5\ \_]/g,'')"
								value="${empty system?'':system.srcSysName }"
								class="form-control" datatype="*" nullmsg="源系统名称" required />
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-4 control-label"
							style="white-space: nowrap; text-align: left">源代码:</label>
						<div class="col-sm-7">
							<input type="text" name="srcCode" id="srcCode1" onkeyup="value=value.replace(/[\W]/g,'')"
								value="${empty system?'':system.srcCode }"
								class="form-control" datatype="*" nullmsg="源代码" required />
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-4 control-label"
							style="white-space: nowrap; text-align: left">源代码名称:</label>
						<div class="col-sm-7">
							<input type="text" name="srcCodeName" id="srcCodeName1" onkeyup="value=value.replace(/[^\a-\z\A-\Z0-9\u4E00-\u9FA5\ \_]/g,'')"
								value="${empty system?'':system.srcCodeName }"
								class="form-control" datatype="*" nullmsg="源代码名称" required />
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-4 control-label"
							style="white-space: nowrap; text-align: left">源代码描述:</label>
						<div class="col-sm-7">
							<input type="text" name="srcCodeDesc" id="srcCodeDesc" onkeyup="value=value.replace(/[^\a-\z\A-\Z0-9\u4E00-\u9FA5\ \_]/g,'')"
								value="${empty system?'':system.srcCodeDesc }"
								class="form-control" datatype="*" nullmsg="代码描述" required />
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>

<script>
 //校验
 $("#system-addOrUpdate-form").validate({
	rules : {
		srcSys1 : {
			required : true
		},
		srcSysName : {
			required : true
		},
		srcCode1 : {
			required : true
		},
		srcCodeName1 : {
			required : true
		},
		srcCodeDesc : {
			required : true
		}
	},
	messages : {
		srcSys1 : {
			required : "请输入源系统"
		},
		srcSysName : {
			required : "请输入源系统名称",
		},
		srcCode1 : {
			required : "请输入源代码",
		},
		srcCodeName1 : {
			required : "请输入源代码名称",
		},
		srcCodeDesc : {
			required : "请输入源代码描述",
		}
	}, 
	ignore: ":hidden:not(.chosen-select)",
	submitHandler : function(form) {
		$("#system-addOrUpdate-form").ajaxSubmit({
			type : 'post',
			url : "<%=basePath%>rest/codemanager/system/saveOrEdit",
			success : function(data) {
					if (data.code == 1) {
						layer.open({
							type : 0,
							time : 800,
							icon : 1,
							content : data.msg,
							btn : 0,
							title : false,
							closeBtn : false,
							skin : 'layui-layer-rim',
							end : function() {
								layer.closeAll();
								//location.reload();
							}
						});
					} else {
						layer.msg(data.msg, {
							time : 2000,
							anim : 6
						});
					}
					var params = jQuery("#search-form").serializeJson();
					$("#table").bootstrapTable("refresh", {query: params});
				}
			});
		}
	});
/*  $(document).ready(function(){
	  $("#srcCode1").blur(function(){
	    var srcCode2 = $("#srcCode1").val();
	    var re =/^[a-zA-Z0-9_]{0,}$/;
	    if(!re.test(srcCode2)){
	    	alert("请输入正确的源代码！")
	    	return false;
	    }
	  });
	});
	
$(document).ready(function(){
	  $("#srcSys1").blur(function(){
	    var srcSys = $("#srcSys1").val();
	    var re =/^[A-Za-z]+$/;
	    if(!re.test(srcSys)){
	    	alert("请输入正确的源系统！")
	    	return false;
	    }
	  });
	}); */

</script>